package main

import (
	"CloudInterface/cloud"
	"CloudInterface/common"
	"fmt"
)

func main() {
	appKey := "43e0f4d3fd7f118b5903f86f37b7ac4d"    // 商户的 app_key
	appSecret := "18ilt5wec70cse6izeyv57x400l7wsow" // 商户的秘钥

	cloudClient := cloud.GetCloudClient(appKey, appSecret)

	result := common.ResultData{}
	//获取云应用列表
	result = cloudClient.GetCloudList(common.CloudListParam{})
	fmt.Println(result)
	fmt.Println("============================================")

	//编辑云应用
	result = cloudClient.EditCloudApp(common.EditAppData{
		AppCateNo:             "958f18079e834feeaf0bfee36ff8dd51",
		Name:                  "ca",
		AppModeNo:             "82f56f9267b311008f4cbfb77e90318d",
		Path:                  "F:\\web\\dolit211101-alpha\\files\\v3\\aa\\pp.exe",
		ViewProcess:           "F:\\web\\dolit211101-alpha\\files\\v3\\aa\\pp.exe",
		PreStartStreamerCount: 3,
		StreamerCount:         3,
		AppData: []common.EditReq{{
			//AppNo:                 "6ad8701a9e8947a8a50d89feb8451d67",
			ComputerNo:            "c3f78b0999264670b9770f1c3e8f5b53",
			Path:                  "",
			ViewProcess:           "",
			PreStartStreamerCount: 0,
			StreamerCount:         0,
		}},
	})
	fmt.Println(result)
	fmt.Println("============================================")

	//一键新增云应用
	result = cloudClient.InsertCloudApp(common.InsertAppData{
		AppName:               "czTest15",
		AppModeNo:             "f061424b8a321352a320437a6a16d361",
		ExePath:               "F:\\web\\dolit211101-alpha\\files\\v3\\aa\\pp.exe",
		ViewPath:              "",
		Args:                  "",
		Mark:                  "",
		PreStartStreamerCount: 1,
		StreamerCount:         1,
		AppData: []common.InitAppReq{{
			Peer:                  "10.0.0.21,39.28.124.3",
			ExePath:               "",
			ViewPath:              "",
			Args:                  "",
			PreStartStreamerCount: 0,
			StreamerCount:         0,
		}},
	})
	fmt.Println(result)
	fmt.Println("============================================")
	//禁用或启用云应用
	result = cloudClient.EnableOrDisAble(common.AbleCloudData{
		Status:     2,
		AppCateNos: "a4df2c4617a142cfb05af66eb2bc9ac1",
	})
	fmt.Println(result)
	fmt.Println("============================================")

	//删除云应用
	result = cloudClient.DeleteCloudApp(common.DeleteAppData{
		AppCateNos: "2d5453c262cc400a83e47054f43303fa",
	})
	fmt.Println(result)
	fmt.Println("============================================")

	//启动空闲流路
	//result = cloudClient.StartIdleStreamer(common.StartIdleStreamerData{
	//	AppCode: "a4df2c4617a142cfb05af66eb2bc9ac1",
	//	AppArgs: "",
	//	Minute:  "10",
	//	Type:    "",
	//})
	//fmt.Println(result)

}
